<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/

include("functions.php");
include("cnnxn.php");
connect();

if (isset($_GET['tid'])) {
	$error=$_GET['tid'];
	$SQLce='SELECT * FROM Events WHERE TournamentID="'.$_GET['tid'].'";';
	$sendce=mysqli_query($db,$SQLce) or die(mysqli_error($db));
	if (!$RSce=mysqli_fetch_object($sendce)) {
		$SQLdel='DELETE FROM Tournaments WHERE TournamentID='.$_GET['tid'].';';
		//print $SQLdel;
		$sendit_del=mysqli_query($db,$SQLdel) or die(mysqli_error($db));
		$error=0;
	}
	die(header("Location: Tournaments_viewall.php?er=".$error));
}
?>